package com.csesteel.crm.domain;

import org.hibernate.annotations.*;

import javax.persistence.*;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Set;

/**
 * Created by Administrator on 2015/5/19 0019.
 */
@Entity
@org.hibernate.annotations.Cache(usage=CacheConcurrencyStrategy.READ_WRITE)
@Table(name="crm_tb_role")
@SequenceGenerator(name="SEQ_CRM_TB_ROLE",allocationSize=1,initialValue=1, sequenceName="SEQ_CRM_TB_ROLE")
public class CrmRole implements Serializable {
    private static final long serialVersionUID = 48L;
    @Id
    @GeneratedValue(strategy=GenerationType.SEQUENCE,generator="SEQ_CRM_TB_ROLE")
    @Column(name="role_id")
    private Integer roleId;

    @Column(name="role_code")
    private String roleCode;

    @Column(name="role_name")
    private String roleName;

    @Column(name="role_remark")
    private String roleRemark;

    @OneToMany(fetch = FetchType.EAGER)
    @JoinTable(name = "crm_r_priviledge_role", joinColumns = { @JoinColumn(name = "role_id", referencedColumnName = "role_id") }, inverseJoinColumns = { @JoinColumn(name = "priviledge_id", referencedColumnName = "priviledge_id") })
    private Set<CrmPriviledge> priviledgeRoles;

    public Set<CrmPriviledge> getPriviledgeRoles() {
        return priviledgeRoles;
    }

    public void setPriviledgeRoles(Set<CrmPriviledge> priviledgeRoles) {
        this.priviledgeRoles = priviledgeRoles;
    }


    public String getRoleCode() {
        return roleCode;
    }

    public void setRoleCode(String roleCode) {
        this.roleCode = roleCode;
    }

    public Integer getRoleId() {
        return roleId;
    }

    public void setRoleId(Integer roleId) {
        this.roleId = roleId;
    }

    public String getRoleName() {
        return roleName;
    }

    public void setRoleName(String roleName) {
        this.roleName = roleName;
    }

    public String getRoleRemark() {
        return roleRemark;
    }

    public void setRoleRemark(String roleRemark) {
        this.roleRemark = roleRemark;
    }
}
